﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson13_code1 : MonoBehaviour
{
    // Start is called before the first frame update
    public int index = 0;
    public void TimeLoop()
    {
        index++;
        Debug.LogFormat("index:{0}", index);
    }

    public GameObject obj1;
    public GameObject obj2;

    public void DelObj()
    {
        Destroy(obj2);
    }

    void Start()
    {
        InvokeRepeating("TimeLoop", 1, 1);
        //方式一
        Destroy(obj1, 3);
        //方式二
        Invoke("DelObj", 3);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
